using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;
using SystemFramework.Util;

namespace TF.Access {
	public partial class TF_Blog_Tmp {
        public static List<TF_Blog_Tmp> SelectBlogTmpByOwnerId(int uid, int pageSize, int pageIndex, out int count)
        {
            count = 0;
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_BlogTmpSelectByOwnerId", uid, pageSize, pageIndex))
            {
                List<TF_Blog_Tmp> tF_BlogList = new List<TF_Blog_Tmp>();
                while (dataReader.Read())
                {
                    TF_Blog_Tmp tF_Blog = MakeTF_Blog_Tmp(dataReader);
                    tF_BlogList.Add(tF_Blog);
                }

                if (dataReader.NextResult())
                {
                    if (dataReader.Read())
                    {
                        count = ConvertHelper.GetInt(dataReader[0], 0);
                    }
                }
                return tF_BlogList;
            }
        }

        public static int SelectBlogTmpCountByOwnerId(int ownerId)
        {
            return 
                ConvertHelper.GetInt(
                SqlClientUtility.ExecuteScalar("TF_BlogTmpSelectCountByOwnerId", ownerId),0);
        }
	}
}
